layui.use(['jquery','layer','table','form'],function(){
    var $=layui.jquery;
    var layer=layui.layer;
    var form = layui.form;
    var user = JSON.parse(localStorage.getItem('user'));
    var userId = user.data.userId;

    $('#cancel').click(function () {
        var layer = parent.layer;
        layer.close(layer.index)
    });
    form.on('submit(sub)',function () {
        var productCode = $("input[name=productCode]").val();
        var productSate = $("#productSate option:selected").val();
        var currentpriceProduct = $("input[name=currentpriceProduct]").val();
        var searchKeywords = $("input[name=searchKeywords]").val();
        var productName = $("input[name=productName]").val();
        $.ajax({
            url:"/product/getPersonalProduct",
            type:"post",
            dataType:"json",
            data:{'productCode':productCode,'productSate':productSate,'currentpriceProduct':currentpriceProduct,'searchKeywords':searchKeywords,'productName':productName,'createId':userId,'type':3},
            success:function (data) {
                parent.advancedSearch(data.data);
                var layer = parent.layer;
                layer.close(layer.index);
            }
        })
        return false;
    });
})